package com.zs.service.impl;

import com.zs.dao.UserMapper;
import com.zs.entity.User;
import com.zs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/* @Service注解属于 org.springframework.stereotype包，会将标注类自动注册到Spring容器中。  */

@Service("userService")    //为了使类能被 Spring扫描到，必须为其标注 @Service
public class UserServiceImpl implements UserService {
    //创建 UserServiceImpl类，实现 UserService 接口

    //在 UserMapper上添加 @Autowired注解会使 UserMapper的一个实例被注入到 UserController 实例中。
    @Autowired
    private UserMapper userMapper;

    @Override
    public User userLogin(User u) {
        return userMapper.userLogin(u);
    }

    @Override
    public List<User> getUsers() {
        return userMapper.getUsers();
    }

    @Override
    public int getUserCount() {
        return userMapper.getUserCount();
    }

    @Override
    public List<User> getUsersByPage(Map<String, Integer> cond) {
        return userMapper.getUsersByPage(cond);
    }


}